home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 8_9.lha / 8_9 / 8_9tst.c < prev    next >
Text File  |  1993-08-08  |  1KB  |  45 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <stream.h>
  6. include <ctype.h>
  7.  
  8. include "8_9a1.h"    /* class eFILE */
  9. include "8_9a2.c"    /* eFILE *efopen(char*) */
  10. include "8_9a3.c"    /* efclose(eFILE*) */
  11. include "8_9a4.c"    /* int egetc(eFILE*, long) */
  12. include "8_9a5.c"    /* int eputc(eFILE*, long, int) */
  13. include "8_9b1.h"    /* class randomloc */
  14. include "8_9b2.c"    /* randomloc::randomloc */
  15. include "8_9b3.c"    /* randomloc::operator int() */
  16. include "8_9b4.c"    /* randomloc operator=(randomloc, int) */
  17. include "8_9b5.c"    /* randomloc operator=(randomloc, randomloc) */
  18. include "8_9c1.h"    /* class random */
  19. include "8_9c2.c"    /* random::random() */
  20. include "8_9c3.c"    /* random::~random() */
  21. include "8_9c4.c"    /* int random::openedokay() */
  22. include "8_9c5.c"    /* randomloc random::operator[]() */
  23.  
  24. nt main(int, char**)
  25.  
  26.    random x("tst.data");
  27.  
  28.    int i = x[3];
  29.    cout << "x[3] = " << i;
  30.    if (isprint(i)) cout << ", " << chr(i);
  31.    cout << "\n";
  32.  
  33.    if ((int)x[2])
  34. cout << "if x[2] passed\n";
  35.    else
  36. cout << "if x[2] failed\n";
  37.  
  38.    x[1] = '3';
  39.    cout << "assigned x[1] <- '3'\n";
  40.  
  41.    x[0] = x[9];
  42.    cout << "assigned x[0] <- x[8]\n";
  43.    return 0;
  44.  
  45.